home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 January / enter-2004-01.iso / files / maxima-5.9.0.exe / {app} / share / maxima / 5.9.0 / src / optimize.lisp < prev    next >
Encoding:
Text File  |  2003-02-09  |  2.3 KB  |  76 lines

  1. ;;; -*-  Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;;;     The data in this file contains enhancments.                    ;;;;;
  4. ;;;                                                                    ;;;;;
  5. ;;;  Copyright (c) 1984,1987 by William Schelter,University of Texas   ;;;;;
  6. ;;;     All rights reserved                                            ;;;;;
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8.  
  9.  
  10. (in-package "MAXIMA")
  11.  
  12. (import '(compiler::inline-unsafe compiler::inline-always compiler::boolean
  13.     compiler::definline ) 'cl-maxima)
  14.  
  15. (macsyma-module rat3f)
  16.  
  17.  
  18. (defmacro definline
  19.     (property return-type side-effect-p new-object-p name arg-types
  20.             body)
  21.  `(progn
  22.     (si::remprop ',name 'compiler::fixed-args)
  23.     (push 
  24.      '(,arg-types ,return-type ,(logior (if new-object-p 1 0) (if side-effect-p 2 0))
  25.               ,body)
  26.     (get ',name ',property))))
  27.  
  28. (defun proclaim-property (arg)
  29.   (let ((prop (car arg)))
  30.     (sloop for v in (cdr arg)
  31.        do (assert (symbolp v))
  32.        (setf (get v prop) t))))
  33.  
  34.  
  35.  
  36. (progn
  37. (definline inline-always t nil nil ctimes (t t) "ctimes(#0,#1)")
  38. (definline inline-always t nil nil cplus (t t) "cplus(#0,#1)")
  39. (definline inline-always t nil nil cdifference (t t) "cdifference(#0,#1)")
  40. (definline inline-always t nil nil cmod (t ) "cmod(#0)")
  41. )
  42.  
  43. (definline inline-unsafe fixnum nil nil quot (fixnum fixnum)
  44.           "((#0)/(#1))")
  45.  
  46. (definline inline-unsafe fixnum nil nil rem (fixnum fixnum)
  47.           "((#0)%(#1))")
  48.  
  49. (definline inline-always boolean nil nil bigp (t)
  50.           "(type_of(#0)==t_bignum)")
  51.  
  52.  
  53. (definline inline-always boolean nil nil pointergp (t t)
  54.            "((fix((#0)->s.s_dbind)) > fix(((#1)->s.s_dbind)))")
  55.  
  56.  
  57. ;(and (not (consp x)) (if (si::fixnump x) (= 0 (the fixnum x)) (zerop x)))
  58. (definline inline-always boolean nil nil pzerop (t )
  59.   "@0;(type_of(#0)==t_fixnum ?  (fix(#0)==0)
  60.        :type_of(#0) == t_cons ? 0 
  61.        :type_of(#0)==t_shortfloat ? (sf(#0)==0.0)
  62.        :(type_of(#0)==t_longfloat && (lf(#0)==0.0)))")
  63.  
  64. ;(definline inline-always boolean nil nil pzerop (t )
  65. ;  "(type_of(#0)==t_fixnum ?  (fix(#0)==0)
  66. ;       :type_of(#0)==t_shortfloat ? (sf(#0)==0.0)
  67. ;       :(type_of(#0)==t_longfloat && (lf(#0)==0.0)))")
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.